package com.example.basemvp.login;

import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.basemvp.R;
import com.example.basemvp.base.BaseView;
import com.example.basemvp.bean.UserBean;
import com.example.basemvp.login.loginContract.LoginContract;

public class LoginActivity extends BaseView<LoginPresenter, LoginContract.View> {

    @Override
    protected void init() {
        setContentView(R.layout.activity_main);
        Button btn = findViewById(R.id.tv_login);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                presenter.getContract().requestLogin("123", "456");
            }
        });

    }

    @Override
    protected LoginContract.View getContract() {
        return new LoginContract.View<UserBean>() {
            @Override
            public void handeLogin(UserBean data) {
                Toast.makeText(LoginActivity.this, data.toString(), Toast.LENGTH_LONG).show();
            }
        };
    }

    @Override
    protected LoginPresenter getPresenter() {
        return new LoginPresenter();
    }
}
